package com.module.lemlin.owner

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding

abstract class OwnerViewBindingFragment<VB : ViewBinding> : OwnerAbstractFragment() {

    private var _binding: VB? = null

    val mViewBinding get() = _binding
        ?: throw Exception("View is not binding")

    abstract val inflate: (LayoutInflater, ViewGroup?, Boolean) -> VB

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
    ): View? {
        _binding = inflate(inflater, container, false)
        return _binding?.root
    }

    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }
}